﻿#include "getplandialog.h"
#include "ui_getplandialog.h"
#include <QInputDialog>
#include <QMessageBox>
GetPlanDialog::GetPlanDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::GetPlanDialog) {
    ui->setupUi(this);
}

GetPlanDialog::~GetPlanDialog() {
    delete ui;
}

void GetPlanDialog::on_pushButton_clicked() {
    QString input = QInputDialog::getText(this,tr("Input a name"),tr("Name"));
    ui->listWidget_people->addItem(input);
    this->event.addPerson(input);
}

void GetPlanDialog::on_pushButton_2_clicked() {
    if(ui->lineEdit->text().isEmpty()) {
        QMessageBox::warning(this,tr("error"),tr("Name cannot be empty"));
        return;
    }
    this->plan.setName(ui->lineEdit->text());
    this->event.setDescription(ui->textEdit->toPlainText());
//    if(ui->ch)
}
